package com.frank.demo.config;/*
 *@author:xec
 *@date:2022/3/1  19:57
 */

import com.frank.demo.interceptor.LogInterceptor;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import javax.annotation.Resource;
// 注入拦截器LogInterceptor  拦截器注入时需要把过滤器那个类注释掉
//@Configuration
public class SpringMvcConfig implements WebMvcConfigurer {
    @Resource
    LogInterceptor loginterceptor;

    public void addInterceptors(InterceptorRegistry registry){
        registry.addInterceptor(loginterceptor).addPathPatterns("/**").excludePathPatterns(
                "/test/**",
                "/redis/**",
                "/user/login",
                "/category/all",
                "/ebook/list",
                "/doc/vote/**",
                "/ebook/getEbook",
                "/doc/all/**",
                "/doc/find-content/**",
                "ebook-snapshot/**");
    }
}
